package com.zhongge.alloj.linkedlist;

/**
 * @ClassName Test01
 * @Description TODO 实现反转链表
 * @Author zhongge
 * @Date 2025/9/25 8:18
 * @Version 1.0
 */
public class Test01 {
    public ListNode reverseList(ListNode head) {
        ListNode cur = head.next;
        //断头
        head.next = null;
        while (cur != null) {
            ListNode curN = cur.next;
            cur.next = head;
            head = cur;
            cur = curN;
        }
        return head;
    }
}
